﻿<?php
defined("_VALID_ACCESS") || die('Direct access forbidden');
class SCTV_MaintenanceInformationRequestInstall extends ModuleInstall {
    public function install() {		  
		Base_ThemeCommon::install_default_theme($this->get_type());
		Utils_CommonDataCommon::new_array('SCTV/MaintenanceRequestStatus',array(_M('Open'),_M('Resolved'),_M('Reject'), _M('Closed')), true,true);
		
		$fields = array(
			array('name'=>_M('Maintenance'), 'type'=>'select', 'param'=>array('SCTV_Maintenance'=>'Maintenance Code'), 'required'=>true, 'visible'=>true),
			array('name'=>_M('Information Group'), 'type'=>'select', 'param'=>array('SCTV_InformationGroup'=>'Name'), 'required'=>true, 'visible'=>true),
			array('name'=>_M('Information'), 'type'=>'select', 'param'=>array('SCTV_Information'=>'Name'), 'required'=>true, 'visible'=>true, 'display_callback'=>array('SCTV_MaintenanceInformationRequestCommon', 'display_information'), 'QFfield_callback'=>array('SCTV_MaintenanceInformationRequestCommon', 'QFfield_information')),
			array('name'=>_M('Status'), 'type'=>'commondata', 'required'=>true, 'param' => array('SCTV/MaintenanceRequestStatus'), 'visible'=>true, 'extra'=>false, 'display_callback'=>array('SCTV_MaintenanceInformationRequestCommon', 'display_status'), 'QFfield_callback'=>array('SCTV_MaintenanceInformationRequestCommon', 'QFfield_status')),
			array('name'=>_M('Note'), 'type'=>'long text', 'required'=>false, 'visible'=>true)
		);		
		Utils_RecordBrowserCommon::install_new_recordset('SCTV_MaintenanceInformationRequest', $fields);		
		Utils_RecordBrowserCommon::set_caption('SCTV_MaintenanceInformationRequest', _M('Maintenance Information Request'));
		Utils_RecordBrowserCommon::add_default_access('SCTV_MaintenanceInformationRequest');
		Utils_AttachmentCommon::new_addon('SCTV_MaintenanceInformationRequest'); 	
		
		Utils_RecordBrowserCommon::new_addon('SCTV_Maintenance', 'SCTV_MaintenanceInformationRequest', 'maintenance_addon', _M('Maintenance Information Request'));
		
		
        return true;
    }
 
    public function uninstall() {
		Base_ThemeCommon::uninstall_default_theme($this->get_type());
		Utils_RecordBrowserCommon::uninstall_recordset('SCTV_MaintenanceInformationRequest');
		
		Utils_CommonDataCommon::remove('SCTV/MaintenanceRequestStatus');
		return true;		
    }
 
    public function info() {
        return array(
        	'Author'=>'Tran Trong Hieu',
            'License'=>'SCTV',
            'Description'=>'MaintenanceInformationRequest');
    }
 
    public function simple_setup() { 
        return array('package' => __('MaintenanceInformationRequest'), 'version'=>'1.0');
    }
 
    public function requires($v) {
        return array();
    }
 
    public function version() {
        return array('1.0');
    }
}
 
?>